package until

import (
	"encoding/json"
	"github.com/Baidu-AIP/golang-sdk/aip/censor"
	"user-srv/basic/config"
)

type Checkey struct {
	ConclusionType uint `json:"conclusionType" form:"conclusionType"`
}

func Check(message string) bool {
	//通过access_toke
	data := config.ConfigAppData.BaiDu
	client := censor.NewClient(data.AutAk, data.AutSK)
	//使用百度云API认证机制
	res := client.TextCensor(message)
	var checkey Checkey
	json.Unmarshal([]byte(res), &checkey)
	if checkey.ConclusionType == 1 {
		return true
	}
	return false

}
